//package com.info.zhiduoduo.admin.controller;
//
//import com.info.zhiduoduo.admin.model.formbean.partner.AddEditSubPartnerFormBean;
//import com.info.zhiduoduo.admin.model.formbean.partner.MonthlyCostListFormBean;
//import com.info.zhiduoduo.admin.model.formbean.partner.SettleCostFormBean;
//import com.info.zhiduoduo.admin.model.formbean.partner.SubPartnerListFormBean;
//import com.info.zhiduoduo.admin.service.PartnerCrowdsourceCostService;
//import com.info.zhiduoduo.common.annotation.LogEntity;
//import com.info.zhiduoduo.common.annotation.LogParameter;
//import com.info.zhiduoduo.common.annotation.ZddLog;
//import com.info.zhiduoduo.common.constants.SmartResult;
//import com.info.zhiduoduo.common.constants.system.ZddLogType;
//import com.info.zhiduoduo.common.formbean.BaseSimpleFormBean;
//import com.info.zhiduoduo.common.utils.DateUtil;
//import com.info.zhiduoduo.repository.dto.partner.PartnerCompanyMonthlyCrowdourceCostDto;
//import com.info.zhiduoduo.repository.dto.partner.PartnerCrowdsourceSubDto;
//import com.info.zhiduoduo.repository.dto.partner.PartnerMonthlyCrowdsourceCostDto;
//import com.info.zhiduoduo.repository.dto.partner.PartnerNameDto;
//import com.info.zhiduoduo.repository.entity.partner.PartnerCrowdsourceSub;
//import com.info.zhiduoduo.repository.entity.partner.PartnerMonthlyCrowdCost;
//
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.format.annotation.DateTimeFormat;
//import org.springframework.web.bind.annotation.PostMapping;
//import org.springframework.web.bind.annotation.RequestBody;
//import org.springframework.web.bind.annotation.RequestMapping;
//import org.springframework.web.bind.annotation.RequestParam;
//import org.springframework.web.bind.annotation.RestController;
//
//import java.util.Date;
//
//import io.swagger.annotations.ApiOperation;
//import io.swagger.annotations.ApiParam;
//
//@RestController
//@RequestMapping("/partnerCrowdsourceCost")
//public class PartnerCrowdsourceCostController {
//
//	@Autowired
//	PartnerCrowdsourceCostService partnerCrowdsourceCostService;
//
//	@ApiOperation("获取智众包二级合伙人列表")
//	@PostMapping("/subPartnerList")
//	public SmartResult<PartnerCrowdsourceSubDto> getCrowdsourceSubPartnerList(@RequestBody BaseSimpleFormBean<SubPartnerListFormBean> formBean) {
//		return partnerCrowdsourceCostService.getCrowdsourceSubPartnerList(formBean);
//	}
//
//	@ZddLog(name = "添加或编辑智众包二级合伙人")
//	@ApiOperation(("添加或编辑智众包二级合伙人"))
//	@PostMapping("/addEditSubPartner")
//	public SmartResult addEditCrowdsourceSubPartner(@RequestBody BaseSimpleFormBean<AddEditSubPartnerFormBean> formBean) {
//		return partnerCrowdsourceCostService.addEditCrowdsourceSubPartner(formBean);
//	}
//
//	@ZddLog(type = ZddLogType.DELETE,name = "删除智众包二级合伙人",entities = @LogEntity(entity = PartnerCrowdsourceSub.class,parameters =
//	@LogParameter(fields = "id",parameters = "formBean.reqdata")))
//	@ApiOperation("删除智众包二级合伙人")
//	@PostMapping("/delSubPartner")
//	public SmartResult delCrowdsourceSubPartner(@RequestBody BaseSimpleFormBean<Integer> formBean) {
//		return partnerCrowdsourceCostService.delCrowdsourceSubPartner(formBean);
//	}
//
//	@ApiOperation("搜索可用的智众包二级合伙人(过滤掉已经设置了上级的合伙人列表)")
//	@PostMapping("/validSubPartnerList")
//	public SmartResult<PartnerNameDto> validCrowdsourceSubPartnerList(@RequestBody BaseSimpleFormBean<String> formBean) {
//		return partnerCrowdsourceCostService.getValidCrowdsourceSubPartnerList(formBean);
//	}
//
//	@ApiOperation("获取智众包合伙人列表(所有已设置了智众包成本比例的合伙人列表)")
//	@PostMapping("/validPartnerList")
//	public SmartResult<PartnerNameDto> getValidCrowdsourcePartnerList(@RequestBody BaseSimpleFormBean<String> formBean) {
//		return partnerCrowdsourceCostService.getValidCrowdsourcePartnerList(formBean);
//	}
//
//	@ApiOperation("获取合伙人每月成本分佣列表")
//	@PostMapping("/listMonthlyCost")
//	public SmartResult<PartnerMonthlyCrowdsourceCostDto> listMonthlyCost(@RequestBody BaseSimpleFormBean<MonthlyCostListFormBean> formBean) {
//		return partnerCrowdsourceCostService.listMonthlyCost(formBean);
//	}
//
//	@ApiOperation(value = "获取合伙人每月成本分佣详情列表", notes = "请求参数reqdata: 是合伙人列表中的合伙人成本id")
//	@PostMapping("/listCompanyMonthlyCost")
//	public SmartResult<PartnerCompanyMonthlyCrowdourceCostDto> listCompanyMonthlyCost(@RequestBody BaseSimpleFormBean<Integer> formBean) {
//		return partnerCrowdsourceCostService.listCompanyMonthlyCost(formBean);
//	}
//
//	@ZddLog(type = ZddLogType.UPDATE,name = "结算合伙人众包成本分佣",entities = @LogEntity(entity = PartnerMonthlyCrowdCost.class,parameters =
//	@LogParameter(fields = "id",parameters = "formBean.reqdata.id")))
//	@ApiOperation(value = "结算合伙人众包成本分佣", notes = "请求参数reqdata: 是合伙人列表中的合伙人成本id")
//	@PostMapping("/settleCost")
//	public SmartResult settleCost(@RequestBody BaseSimpleFormBean<SettleCostFormBean> formBean) {
//		return partnerCrowdsourceCostService.settleCost(formBean);
//	}
//
//	@ApiOperation("计算并记录合伙人众包成本佣金(只用作测试环境)")
//	@PostMapping("/calcAndRecordPartnerCrowdCost")
//	public SmartResult<PartnerMonthlyCrowdCost> calcAndRecordPartnerCrowdCost(@ApiParam("月份 yyyy-MM") @RequestParam("month") String month) {
////		if (ContextUtil.isProd()) return SmartResult.fail(StatusMsg.StatusMsg_199);
//		Date date = DateUtil.getDateMonthBeginDate(DateUtil.parseDate(month,"yyyy-MM"));
//		partnerCrowdsourceCostService.recordPartnerCrowdsourceCost(date);
//		return SmartResult.success();
//	}
//
//}
